Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class FrmCrSoCai
    Private matk, tentk As String
    Private thangnam As Date
    Private customerReport As ReportDocument
    Private tungay As String
    Private denngay As String
    Private Sub FrmCrSoCai_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim tiendauky As Double = 0
        Dim sqlQuery As String = ""
        Dim data_temp As DataTable
        Dim nodauvn As Double = 0
        Dim codauvn As Double = 0
        sqlQuery = "SELECT nodauvn, codauvn from tbl_dot_temp_socai2 WHERE soCT = 'ZZZZZZZZ'"
        data_temp = moduleDatabaseConn.GetDataTable(sqlQuery)
        If data_temp.Rows.Count > 0 Then
            Try
                nodauvn = data_temp.Rows.Item(0).Item(0)
                codauvn = data_temp.Rows.Item(0).Item(1)
            Catch ex As Exception
            End Try
        End If

        sqlQuery = "SELECT * from tbl_dot_temp_socai2 WHERE soCT <> 'ZZZZZZZZ' ORDER BY ngayCT, soCT"
        'sqlQuery = "SELECT * from tbl_dot_temp_socai2  "
        Dim reportPath = Application.StartupPath & "\" & "crSoCai.rpt"
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        customerReport.SetParameterValue("TMatk", matk)
        customerReport.SetParameterValue("TTentk", tentk)
        customerReport.SetParameterValue("tungay", tungay)
        customerReport.SetParameterValue("denngay", denngay)
        customerReport.SetParameterValue("ketoantruong", globalVariale.KETOANTRUONG)
        customerReport.SetParameterValue("giamdoc", globalVariale.TONGGIAMDOC)
        'customerReport.SetParameterValue("TThangnam", thangnam)
        customerReport.SetParameterValue("nodauvn", nodauvn)
        customerReport.SetParameterValue("codauvn", codauvn)
        Me.CrNXTTongHopview.ReportSource = customerReport
    End Sub


    Public Sub setMatk(ByVal s As String)
        matk = s
    End Sub
    Public Sub setTentk(ByVal s As String)
        tentk = s
    End Sub

    'Public Sub setThangnam(ByVal s As Date)
    '    thangnam = s
    'End Sub
    Public Sub setTungay(ByVal s As String)
        tungay = s
    End Sub
    Public Sub setDenngay(ByVal s As String)
        denngay = s
    End Sub
End Class
